package config

import (
	conf "egin/config"

	"github.com/spf13/viper"
)

//Config struct
var config *Config

func init() {

	Default()

}

type Config struct {
	conf.Config
	Viper *viper.Viper
}

// New returns an initialized Config instance.
func New() *Config {
	config = new(Config)
	config.Viper = viper.New()
	return config

}

//New Config struct
func Default() *Config {
	New()
	config.Viper.SetConfigName("config")
	config.Viper.AddConfigPath("./")
	config.Viper.ReadInConfig()
	config.Viper.Unmarshal(&config.Config)
	return config
}

func C() conf.Config {
	return config.Config
}

func Conf() *Config {
	return config
}
